package org.smoke.util;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * 配置工具类,用于处理诸如Api Status、不同Env（test、product）区分等
 * @author hezhiyu on 14/10/19.
 */
public class LangConfigUtil {

    private static final Map<String, String> langMap;

    static {

        langMap = new HashMap<>();
        try {
            Properties properties = new Properties();
            // todo msg_zh_CN.properties 会做成国际化
            properties.load(LangConfigUtil.class.getClassLoader().getResourceAsStream("msg_zh_CN.properties"));
            for (Object pro : properties.keySet()) {
                String key = (String)pro;
                String value = properties.getProperty(key);
                langMap.put(key, value);
            }
        } catch (IOException e) {
            throw new RuntimeException();
        }
    }

    public static String getContent(String name) {
        return langMap.get(name);
    }
}
